/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gruppe1projekt.ModelLayer;

import java.util.ArrayList;

/**
 *
 * @author Moulde
 */
public class SaleContainer
    {

    private ArrayList<Sale> Sales;
    private static SaleContainer instance;

    public static SaleContainer getInstance()
    {
        if (instance == null)
        {
            instance = new SaleContainer();
        }

        return instance;
    }

    public ArrayList<Sale> getSales()
    {
        return Sales;
    }

    public void setSales(ArrayList<Sale> Sales)
    {
        this.Sales = Sales;
    }

    public void addSale(Sale sale)
    {
    }

//    private ArrayList<ProductSalesLine> resolve(ArrayList<ProductSalesLine> products, Product product)
//    {
//        if (product.getSubProducts().size() > 0)
//        {
//            for (Product subProduct : product.getSubProducts())
//            {
//                products = resolve(products, subProduct);
//            }
//        }
//
//        return products;
//    }
//
//    public ArrayList<ProductSalesLine> resolve(ProductSalesLine product)
//    {
//        return resolve(new ArrayList<ProductSalesLine>(), product);
//    }

    public ArrayList<Product> simpleResolveProducts(Product product)
    {
        ArrayList<Product> products = new ArrayList<Product>();
        for (Product subProduct : product.getSubProducts())
        {
            products.add(subProduct);
        }
        return products;
    }

//    private ArrayList<Product> AddToArray(ArrayList<Product> products, Product product)
//    {
//        ArrayList<Product> finalProducts = products;
//
//        for (Product oneproduct : finalProducts)
//        {
//            finalProducts.add(oneproduct);
//        }
//
//        return products;
//    }
    }















